package flexo.physic.collision;

import flexo.math.Vector;

public class Box extends Shape
{
	public Vector center;
	public Vector halfSize;
	
	public Vector up;
	public Vector right;
	public Vector depth;
	
	public Box()
	{
		super(CollisionDetector.ShapeType.Box);
		center = new Vector();
		halfSize = new Vector(0.5f,0.5f,0.5f);
		
		up = new Vector(0,1,0);
		right = new Vector(1,0,0);
		depth = new Vector(0,0,1);
	}
	
	public Box(float size)
	{
		this();
		setSize(size);
	}
	
	public void setSize(float size)
	{
		if (size > 0)
		{
			halfSize.set(size/2.0f, size/2.0f, size/2.0f);
		}				
	}
	
	public void setUp(Vector up)
	{
		this.up.set(up);
		this.up.normalize();
	}
	
	public void setRight(Vector right)
	{
		this.right.set(right);
		this.right.normalize();
	}
	
	public void setDepth(Vector depth)
	{
		this.depth.set(depth);
		this.depth.normalize();
	}
}
